/*
 * client_mgr.cpp
 *
 *  Created on: Aug 3, 2013
 *      Author: killerg
 */

#include "server_deps.h"
#include "server.h"
#include "auth_mgr.h"
#include "logon_session.h"
#include "server_console.h"

#include "share/clock.h"
#include "share/msg.h"
#include "share/sl_msg.pb.h"

void auth_mgr::update() {
    for (auto itr = auth_data.begin();
        itr != auth_data.end();
        ) {

        auto cur = itr++;

        cur->second.timer_to_invalid -= g_clock->delta;
        if (cur->second.timer_to_invalid < 0) {
        	if (g_logonsess->base::tran.is_connected()) {
                CREATE_SL_SMSG(SPlayerLogon, playerlogon);
                playerlogon->set_playerid(cur->first);
                playerlogon->set_ok(false);
                g_logonsess->base::tran.send(___msg);
        	}

            auth_data.erase(cur);
        }
    }
}
